abstract class Bird
{
   protected FlyBehavior theFlyBehavior;
   protected SwimBehavior theSwimBehavior;


   public Bird()
   {

   }


   public void fly()
   {
   }
   public void swit()
   {

   }

  
   public void display()
   {

   }
}
 class Eagle extends Bird
{

   public Eagle(FlyBehavior flyBehavior, SwimBehavior swimBehavior)
   {
      this.theSwimBehavior = swimBehavior;
      this.theFlyBehavior = flyBehavior;
   }

   public void display()
   {
      theSwimBehavior.swim();
      theFlyBehavior.fly();
   }
}
class Penguin extends Bird
{


   public Penguin(FlyBehavior flyBehavior, SwimBehavior swimBehavior)
   {
      this.theFlyBehavior = flyBehavior;
      this.theSwimBehavior = swimBehavior;
   }

   public void display()
   {
      this.theSwimBehavior.swim();
      this.theFlyBehavior.fly();
   }
}
 class Piegon extends Bird
{

   public Piegon(FlyBehavior flyBehavior, SwimBehavior swimBehavior)
   {
      this.theFlyBehavior = flyBehavior;
      this.theSwimBehavior = swimBehavior;
   }

 
   public void display()
   {
      theSwimBehavior.swim();
      theFlyBehavior.fly();
   }
}
 interface SwimBehavior
{

    public void swim();
}
 class UnableSwim implements SwimBehavior
{
   public UnableSwim()
   {

   }
    @Override
      public void swim()
      {
         System.out.println("扑腾几下就淹死了");
      }
}
 class AbleSwim implements SwimBehavior
{

  
   public AbleSwim()
   {

   }


   @Override
   public void swim()
   {
      System.out.println("鱼翔浅底");
   }
}
interface FlyBehavior
{


   public void fly();
}
 class UnableFly implements FlyBehavior
{

 
   public UnableFly()
   {

   }


   public void fly()
   {
      System.out.println("扑腾几下飞不起来");
   }
}
class FreeFly implements FlyBehavior
{

   public FreeFly()
   {

   }

   public void fly()
   {
      System.out.println("可以飞");
   }
}
public class Client
{
   public static void main(String[] args) {
      Bird one = new Eagle(new FreeFly(),new UnableSwim());
      one.display();

      Bird two = new Piegon(new FreeFly(),new UnableSwim());
      two.display();

      Bird three = new Penguin(new UnableFly(),new AbleSwim());
      three.display();
   }
}